<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 切换导航加载不同的应用 -->
    <a href="">a应用</a>
    <a href="">b应用</a>
    <script></script>
    <!-- 源码中single-span使用roll-up打包的 -->
    <script type="module">
        let { registerApplication, start } = singleSpa; //接入协议 let app1 = { bootstrap: [ //启动 只执行一次 async() => { console.log('app1 启动'); }, async() => { console.log("app2 启动'"); }, ], mount: async() => { //挂载 console.log('app1 mount'); }, unmount: async() =>
        { //挂载 console.log('app1 unmount'); } } //注册微应用 registerApplication( 'app1', //这个名字可以用于过滤防止重复加载 async() => app1, location => location.hash == "#/a", //路径匹配到后会加载应用 customProps, //自定义属性 ) //注册微应用 registerApplication( 'app2', //这个名字可以用于过滤防止重复加载 async()
        => app1, location => location.hash == "#/b", //路径匹配到后会加载应用 customProps, //自定义属性 ) start();
    </script>
</body>

</html>